<?php
function outGrade($grades){
    asort($grades);
    $keys=array_keys($grades);
//    p($grades,$keys);
    $maxIndex=count($keys)-1;//key数组的最大整数索引
    $minBh=$keys[0];//最低成绩的裁判编号
    $maxBh=$keys[$maxIndex];
    echo"打出最低分的裁判为：",$minBh,",打分为：",$grades[$minBh],"\n";
    echo"打出最低分的裁判为：",$maxBh,",打分为：",$grades[$minBh],"\n";
    echo"最后得分为：",round((array_sum($grades)-$grades[$minBh]-$grades[$maxBh])/($maxIndex-1),2);

}
$grades=[
    '一号裁判'=>98.2,
    '二号裁判'=>97.5,
    '三号裁判'=>91,
    '四号裁判'=>89,
    '五号裁判'=>99,
    '六号裁判'=>98.5,
    '七号裁判'=>96.6,
    '八号裁判'=>93.4,
];
outGrade($grades);